<?php 
namespace app\admin\service;


use app\admin\model\MemberWalletLog;
use think\facade\Db;

/**
 * 宝石（粮食）记录管理-服务类
 * @author 小树林
 * @since: 2023/12/25
 * Class MemberWalletLogService
 * @package app\admin\service
 */
class MemberWalletLogService extends BaseService
{
    /**
     * 构造函数
     * LevelService constructor.
     */
    public function __construct()
    {
        $this->model = new MemberWalletLog();
    }
	
	/**
     * 获取数据列表
     * @return array
     * @since 2023/12/25
     * @author 小树林
     */
    public function getList()
    {
        $param = request()->param();

        //是否为远程搜索查询
        $is_query = $param['_is_query'] ?? '';
        if(!empty($is_query)){
            return parent::query($param);
        }

        // 查询条件
        $map = [];
		
	
	    // 类别 1:游戏奖金 2:投注游戏 3:挖矿所得 4
        $type = isset($param['type']) ? (int)$param['type'] : 0;
        if ($type) {
            $map[] = ['type', '=', $type];
        }
		
	    // 有效标识
        $mark = isset($param['mark']) ? (int)$param['mark'] : 0;
        if ($mark) {
            $map[] = ['mark', '=', $mark];
        }
        $uid = isset($param['uid']) ? (int)$param['uid'] : 0;
        if ($uid) {
            $map[] = ['uid', '=', $uid];
        }
        $category = isset($param['category']) ? (int)$param['category'] : 0;
        if ($category) {
            $map[] = ['category', '=', $category];
        }
	
        $field = '*';
        $with = [];
        $sort = '';
       $result= parent::getList($map,$field,$with,$sort);
        foreach ($result['data'] as $index => $datum) {
            $result['data'][$index]['member_name']=Db::name('member')->where('id',$datum['uid'])->value('nickname');
       }
        return $result; // TODO: Change the autogenerated stub
    }


                                                
}